Find entry_points with importlib(.|_)metadata, drop setuptools from dependencies#385
Conversation
|
https://docs.python.org/3.8/library/importlib.metadata.html#entry-points It seems that |
| from pylsp import _utils, hookspecs, uris, PYLSP | ||
|
|
||
| # See compatibility note on `group` keyword: | ||
| # https://docs.python.org/3/library/importlib.metadata.html#entry-points |
There was a problem hiding this comment.
It seems that from
importlib.metadata import entry_pointswill work even before 3.10.
Reproduced here from this link, emphasis mine:
The “selectable” entry points were introduced in
importlib_metadata3.6 and Python 3.10. Prior to those changes,entry_pointsaccepted no parameters and always returned a dictionary of entry points, keyed by group. For compatibility, if no parameters are passed toentry_points, aSelectableGroupsobject is returned, implementing that dict interface. In the future, callingentry_pointswith no parameters will return anEntryPointsobject. Users should rely on the selection interface to retrieve entry points by group.
Before 3.10 stdlib, and older importlib_metadata, all of the entry_points in $PREFIX/lib/python-3* are discovered and parsed without any kind of cache. In a large environment, this can take a number of seconds. The venerable entrypoints did this a bit better, but is now deprecated, leaving this half-measure until 3.9 EOL to avoid getting bitten by inconsistent return types and performance cliffs.
entry_points with importlib(.|_)metadata, drop setuptools from dependenciesentry_points with importlib(.|_)metadata, drop setuptools from dependencies
|
It seems this requires dropping support for Python 3.7, so I'm going to leave it for 1.8.0. |
oh, |
…metadata (or backport if needed)
9dfe6b2 to
234a5d9
Compare
|
re ⚾ d |
ccordoba12
left a comment
There was a problem hiding this comment.
Thanks @bollwyvl for your help with this!
…from `dependencies` (python-lsp#385)
References
setuptools/pkg_resourceswithimportlib(.|_)metadata#384Changes
setuptools(only used forentry_pointdiscovery)importlib_metdataon python <3.10importlib.metadataon python 3.10+pluggydoes the same